home *** CD-ROM | disk | FTP | other *** search
/ Shareworld 8 / Shareworld 8 (Disk 2 of 2).adf / Programs / MachineCodeHelloWorld / MyIncludes / SimpleWorkbenchStart.i < prev    next >
Encoding:
Text File  |  1978-02-11  |  1.7 KB  |  101 lines

  1.  
  2. ; Simple Workbench Startup macros I use.
  3. ; Does not find the current directory or search tooltypes.
  4.  
  5. ;
  6.  
  7. ; Matthew Goode - 18/1/97
  8.  
  9.  
  10. ; --------------------------------------------------------------
  11. ; Call this first.
  12. ; Purpose: Open Standard Libraries that have open, and handles 
  13. ; Worbench/CLI starting.
  14.  
  15. StartHerUp    Macro
  16.     ;If wanting to look at CLI stuff you should save d0/a0 at this point
  17.     Sub.l a1,a1
  18.     CALLEXEC FindTask
  19.     Move.l d0,myTask
  20.     Move.l d0,a4
  21.     tst.l pr_CLI(a4)
  22.     bne .isCLI
  23.     Moveq #0,d0
  24.     Lea pr_MsgPort(a4),a0
  25.     CALLEXEC WaitPort
  26.     Lea pr_MsgPort(a4),a0
  27.     CALLEXEC GetMsg
  28.     Move.l d0,myTasksMessage
  29.     Bra .notCLI
  30. .isCLI
  31.  
  32. .notCLI
  33. OpenLibraries
  34.     IFD UseIntuitionLib
  35.      Lea iName,a1
  36.      Moveq #0,d0
  37.      CALLEXEC OpenLibrary
  38.      Move.l d0,_IntuitionBase
  39.      Beq LibraryFailure
  40.     EndC
  41.  
  42.     IFD UseGraphicsLib
  43.      Lea gName,a1
  44.      Moveq #0,d0
  45.      CALLEXEC OpenLibrary
  46.      Move.l d0,_GfxBase
  47.      Beq LibraryFailure
  48.     EndC
  49.  
  50.     IFD UseDosLib
  51.      Lea dName,a1
  52.      Moveq #0,d0
  53.      CALLEXEC OpenLibrary
  54.      Move.l d0,_DOSBase
  55.      Beq LibraryFailure
  56.     EndC
  57.  
  58.     EndM
  59.  
  60. ; --------------------------------------------------------------
  61. ; Call this last.
  62. ; Purpose: Closes Standard Libraries that have open, and finishes off
  63. ; Worbench/CLI exiting.
  64.  
  65. TidyUp    Macro
  66. LibraryFailure
  67.     IFD UseDosLib
  68.      move.l _DOSBase,d0
  69.      beq .noDos
  70.      move.l d0,a1
  71.      CALLEXEC CloseLibrary
  72. .noDos
  73.     EndC
  74.  
  75.     IFD UseGraphicsLib
  76.      move.l _GfxBase,d0
  77.      beq .noGraf
  78.      move.l d0,a1
  79.      CALLEXEC CloseLibrary
  80. .noGraf
  81.     EndC
  82.     IFD UseIntuitionLib
  83.      move.l _IntuitionBase,d0
  84.      beq .noInt
  85.      move.l d0,a1
  86.      CALLEXEC CloseLibrary
  87. .noInt
  88.     EndC
  89. TheEndIsNear
  90.     Move.l myTasksMessage,d0
  91.     Beq .cli
  92.     CALLEXEC Forbid
  93.     Move.l d0,a1
  94.     CALLEXEC ReplyMsg
  95.     rts
  96. .cli
  97.     Moveq #0,d0    ;No Error for CLI
  98.     rts
  99.  
  100.     EndM
  101.